<?php

namespace app\admin\model\cashflow;

use think\Model;

/**
 * Record
 */
class Record extends Model
{
    // 表名
    protected $name = 'cashflow_record';

    // 自动写入时间戳字段
    protected $autoWriteTimestamp = false;


    public function getImprestAmountAttr($value): float
    {
        return (float)$value;
    }

    public function getIncomeAmountAttr($value): float
    {
        return (float)$value;
    }

    public function getExpendAmountAttr($value): float
    {
        return (float)$value;
    }

    public function getTotalAmountAttr($value): float
    {
        return (float)$value;
    }

    public function cashflowCompany(): \think\model\relation\BelongsTo
    {
        return $this->belongsTo(\app\admin\model\cashflow\Company::class, 'cashflow_company_id', 'id');
    }
}